package com.easycoding.framework.aop;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;


public class ExecuteTime {

	private static final Log logger = LogFactory.getLog(ExecuteTime.class);
	 
    public Object around(ProceedingJoinPoint pjp) throws Throwable {  
        long time = System.currentTimeMillis();  
        Object retVal = pjp.proceed();  
        time = System.currentTimeMillis() - time;
        String methodShortName = pjp.getSignature().toShortString();
        methodShortName = methodShortName.substring(methodShortName.indexOf(".")); 
        if(logger.isDebugEnabled()){
            logger.debug("[" + pjp.getTarget().toString() + methodShortName + "] 方法执行耗时 : " + time + "ms");
         }
        return retVal;  
    }  
  
}
